package 面试.动态代理.JDK;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DebugInvocationHandler implements InvocationHandler {
    private final Object target;

    public DebugInvocationHandler(Object target) {
        this.target = target;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("方法调用前"+method.getName());
        Object result=method.invoke(target,args);

        System.out.println("方法调用后"+method.getName());
        return result;
    }
}
